
		clear all

		macro drop _all
		graph drop _all


*global folder "~/Dropbox/Papers\23CBFunctionsHistory\ConstrainOrInform"

*cd "$folder"

*use "$folder\01Data\CentralBanksSovereignCredibility.dta"

xtset id year

gen decade = 10 * floor(year/10)
gen twentyfive = 25 * floor(year/25)
gen five = 5 * floor(year/5)

gen exist = CBExistSurvival
gen govcredit = CBGovtCredit
gen pricredit = CBDiscount
gen default = SovDefaultRR
gen inflation = Inflation
gen intrate = tenyearbondrate
gen exchrate = ExchangeRateWithUK

gen lnGovtDebtGDP = ln(GovtDebtGDP)

gen Conflict = .
replace Conflict = 1 if InterNatWar >0 & InterNatWar !=.
replace Conflict = 1 if DomesticConflict >0 & DomesticConflict !=.
replace Conflict = 0 if DomesticConflict ==0 & InterNatWar == 0
replace Conflict = 0 if Conflict == .

by id: gen PerCapGDPGrowth = (GDPPerCapita - GDPPerCapita[_n-1])/GDPPerCapita[_n-1]
gen lnUrbanPopulation = ln(UrbanPopulation)


gen shockGov = CBGovtCreditSurvival

gen shockPriv = CBDiscountSurvival

gen shockEither = CBGovtCreditSurvival
replace shockEither = 1 if shockPriv == 1

*******************
** Set-up of LPs **
*******************

***** LHS variable: the response variable
forvalues i=0/25 {


		gen inflation`i' = (f`i'.inflation - l.inflation)
		gen intrate`i' = (f`i'.intrate - l.intrate)
		gen exchrate`i' = (f`i'.exchrate - l.exchrate)
		gen default`i' = (f`i'.default - l.default)
	}

sort id year
gen NewlyTreatedGov = .
by id: replace NewlyTreatedGov = 1 if CBGovtCreditSurvival == 1
by id: replace NewlyTreatedGov = 1 if l.CBGovtCreditSurvival == 1
by id: replace NewlyTreatedGov = 1 if l2.CBGovtCreditSurvival == 1
by id: replace NewlyTreatedGov = 1 if l3.CBGovtCreditSurvival == 1
by id: replace NewlyTreatedGov = 1 if l4.CBGovtCreditSurvival == 1
by id: replace NewlyTreatedGov = 1 if l5.CBGovtCreditSurvival == 1
by id: replace NewlyTreatedGov = 1 if l6.CBGovtCreditSurvival == 1
by id: replace NewlyTreatedGov = 1 if l7.CBGovtCreditSurvival == 1
by id: replace NewlyTreatedGov = 1 if l8.CBGovtCreditSurvival == 1
by id: replace NewlyTreatedGov = 1 if l9.CBGovtCreditSurvival == 1
by id: replace NewlyTreatedGov = 1 if l10.CBGovtCreditSurvival == 1
by id: replace NewlyTreatedGov = 1 if l11.CBGovtCreditSurvival == 1
by id: replace NewlyTreatedGov = 1 if l12.CBGovtCreditSurvival == 1
by id: replace NewlyTreatedGov = 1 if l13.CBGovtCreditSurvival == 1
by id: replace NewlyTreatedGov = 1 if l14.CBGovtCreditSurvival == 1
by id: replace NewlyTreatedGov = 1 if l15.CBGovtCreditSurvival == 1
by id: replace NewlyTreatedGov = 1 if l16.CBGovtCreditSurvival == 1
by id: replace NewlyTreatedGov = 1 if l17.CBGovtCreditSurvival == 1
by id: replace NewlyTreatedGov = 1 if l18.CBGovtCreditSurvival == 1
by id: replace NewlyTreatedGov = 1 if l19.CBGovtCreditSurvival == 1
by id: replace NewlyTreatedGov = 1 if l20.CBGovtCreditSurvival == 1
by id: replace NewlyTreatedGov = 1 if l21.CBGovtCreditSurvival == 1
by id: replace NewlyTreatedGov = 1 if l22.CBGovtCreditSurvival == 1
by id: replace NewlyTreatedGov = 1 if l23.CBGovtCreditSurvival == 1
by id: replace NewlyTreatedGov = 1 if l24.CBGovtCreditSurvival == 1


gen NewlyTreatedDisc = .
by id: replace NewlyTreatedDisc = 1 if CBDiscountSurvival == 1
by id: replace NewlyTreatedDisc = 1 if l.CBDiscountSurvival == 1
by id: replace NewlyTreatedDisc = 1 if l2.CBDiscountSurvival == 1
by id: replace NewlyTreatedDisc = 1 if l3.CBDiscountSurvival == 1
by id: replace NewlyTreatedDisc = 1 if l4.CBDiscountSurvival == 1
by id: replace NewlyTreatedDisc = 1 if l5.CBDiscountSurvival == 1
by id: replace NewlyTreatedDisc = 1 if l6.CBDiscountSurvival == 1
by id: replace NewlyTreatedDisc = 1 if l7.CBDiscountSurvival == 1
by id: replace NewlyTreatedDisc = 1 if l8.CBDiscountSurvival == 1
by id: replace NewlyTreatedDisc = 1 if l9.CBDiscountSurvival == 1
by id: replace NewlyTreatedDisc = 1 if l10.CBDiscountSurvival == 1
by id: replace NewlyTreatedDisc = 1 if l11.CBDiscountSurvival == 1
by id: replace NewlyTreatedDisc = 1 if l12.CBDiscountSurvival == 1
by id: replace NewlyTreatedDisc = 1 if l13.CBDiscountSurvival == 1
by id: replace NewlyTreatedDisc = 1 if l14.CBDiscountSurvival == 1
by id: replace NewlyTreatedDisc = 1 if l15.CBDiscountSurvival == 1
by id: replace NewlyTreatedDisc = 1 if l16.CBDiscountSurvival == 1
by id: replace NewlyTreatedDisc = 1 if l17.CBDiscountSurvival == 1
by id: replace NewlyTreatedDisc = 1 if l18.CBDiscountSurvival == 1
by id: replace NewlyTreatedDisc = 1 if l19.CBDiscountSurvival == 1
by id: replace NewlyTreatedDisc = 1 if l20.CBDiscountSurvival == 1
by id: replace NewlyTreatedDisc = 1 if l21.CBDiscountSurvival == 1
by id: replace NewlyTreatedDisc = 1 if l22.CBDiscountSurvival == 1
by id: replace NewlyTreatedDisc = 1 if l23.CBDiscountSurvival == 1
by id: replace NewlyTreatedDisc = 1 if l24.CBDiscountSurvival == 1



	***** variables to store the impulse response (vector of betas from the LP regressions) and standard errors
	gen b_GovIntrate=.
	gen se_GovIntrate=.
	gen ci_ul95_GovIntrate=.
	gen ci_ll95_GovIntrate=.
	gen b_PrivIntrate=.
	gen se_PrivIntrate=.
	gen ci_ul95_PrivIntrate=.
	gen ci_ll95_PrivIntrate=.
	gen b_EitherIntrate=.
	gen se_EitherIntrate=.
	gen ci_ul95_EitherIntrate=.
	gen ci_ll95_EitherIntrate=.

	gen b_GovIntrateWar=.
	gen se_GovIntrateWar=.
	gen ci_ul95_GovIntrateWar=.
	gen ci_ll95_GovIntrateWar=.
	gen b_PrivIntrateWar=.
	gen se_PrivIntrateWar=.
	gen ci_ul95_PrivIntrateWar=.
	gen ci_ll95_PrivIntrateWar=.
	gen b_EitherIntrateWar=.
	gen se_EitherIntrateWar=.
	gen ci_ul95_EitherIntrateWar=.
	gen ci_ll95_EitherIntrateWar=.
	
	gen b_GovDefault=.
	gen se_GovDefault=.
	gen ci_ul95_GovDefault=.
	gen ci_ll95_GovDefault=.
	gen b_PrivDefault=.
	gen se_PrivDefault=.
	gen ci_ul95_PrivDefault=.
	gen ci_ll95_PrivDefault=.
	gen b_EitherDefault=.
	gen se_EitherDefault=.
	gen ci_ul95_EitherDefault=.
	gen ci_ll95_EitherDefault=.

	gen b_GovDefaultWar=.
	gen se_GovDefaultWar=.
	gen ci_ul95_GovDefaultWar=.
	gen ci_ll95_GovDefaultWar=.
	gen b_PrivDefaultWar=.
	gen se_PrivDefaultWar=.
	gen ci_ul95_PrivDefaultWar=.
	gen ci_ll95_PrivDefaultWar=.
	gen b_EitherDefaultWar=.
	gen se_EitherDefaultWar=.
	gen ci_ul95_EitherDefaultWar=.
	gen ci_ll95_EitherDefaultWar=.
	
	
	
	
* number of lags
*For interest rates
local MaxLPLags 2



* horizon
local horizon 15

* variables for the p-value test

forvalues h = 0/`horizon' {
    gen testp_Gov`h' = .
    gen testp_GovWar`h' = .
    gen testp_GovInfla`h' = .
    gen testp_Priv`h' = .
    gen testp_PrivWar`h' = .
    gen testp_PrivInfla`h' = .
    gen testp_Mil`h' = .
    gen testp_MilWar`h' = .
    gen testp_MilInfla`h' = .
	}



	

 **** exclude the contemporaneous lag of impulse (CB shock) and response (interest rate / inflation)

forvalues j=1/`MaxLPLags' {

 foreach impulse_response of varlist exist govcredit pricredit inflation intrate exchrate default {

 gen l`j'`impulse_response' = L`j'.`impulse_response'

 	}
 }


 


*************************
*** Local projections ***
*************************

*Borrowing costs, Conflict=0
forvalues j=0/`horizon' {

reghdfe intrate`j' shockEither `rhscontrolsIntrate' if NewlyTreatedGov ==1 & l.Conflict == 0  & year >= 1600 | F`j'.exist !=1 & year >= 1600 , absorb(id twentyfive)
		  estimates store IntRateEither`j'
		  eststo ols_EitherIntrate`j'
		  replace b_EitherIntrate  = _b[shockEither] if _n == `j'+1
		  replace se_EitherIntrate = _se[shockEither] if _n == `j'+1
}

forvalues j=0/`horizon' {

reghdfe intrate`j' shockGov `rhscontrolsIntrate' if NewlyTreatedGov ==1 & l.Conflict == 0  & year >= 1600 | F`j'.govcredit ==0 & year >= 1600 , absorb(id twentyfive)
  		  estimates store IntRateGov`j'
		  eststo ols_GovIntrate`j'
		  replace b_GovIntrate  = _b[shockGov] if _n == `j'+1
		  replace se_GovIntrate = _se[shockGov] if _n == `j'+1
}


forvalues j=0/`horizon' {

reghdfe intrate`j' shockPriv `rhscontrolsIntrate' if NewlyTreatedDisc ==1 & l.Conflict == 0  & year >= 1600 | F`j'.pricredit ==0 & year >= 1600 , absorb(id twentyfive)
		  estimates store IntRatePriv`j'		  
		  eststo ols_PrivIntrate`j'
		  replace b_PrivIntrate  = _b[shockPriv] if _n == `j'+1
		  replace se_PrivIntrate = _se[shockPriv] if _n == `j'+1
}


esttab IntRateEither0 IntRateEither2 IntRateEither4 IntRateEither6 IntRateGov0 IntRateGov2 IntRateGov4 IntRateGov6 IntRatePriv0 IntRatePriv2 IntRatePriv4 IntRatePriv6 using "$folder\04Tables\IntRateIRFs1.tex", replace nogaps title( ) mtitles("(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)" "(9)" "(10)" "(11)" "(12)") nonumbers cells(b(star fmt(%9.2f)) se(par)) starlevels(* 0.1 ** 0.05 *** 0.01) nonumbers stats(F p N N_clust, fmt(%9.2f %9.2f %9.0f %9.0f) labels("$ F $" "$ Prob > F $" "\# Observations" "Countries")) legend label style(tex)
esttab IntRateEither8 IntRateEither10 IntRateEither12 IntRateEither14 IntRateGov8 IntRateGov10 IntRateGov12 IntRateGov14 IntRatePriv8 IntRatePriv10 IntRatePriv12 IntRatePriv14 using "$folder\04Tables\IntRateIRFs2.tex", replace nogaps title( ) mtitles("(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)" "(9)" "(10)" "(11)" "(12)") nonumbers cells(b(star fmt(%9.2f)) se(par)) starlevels(* 0.1 ** 0.05 *** 0.01) nonumbers stats(F p N N_clust, fmt(%9.2f %9.2f %9.0f %9.0f) labels("$ F $" "$ Prob > F $" "\# Observations" "Countries")) legend label style(tex)
clear results


*Borrowing costs, Conflict=1
forvalues j=0/`horizon' {

reghdfe intrate`j' shockEither `rhscontrolsIntrate' if NewlyTreatedGov ==1 & l.Conflict == 1  & year >= 1600 | F`j'.exist !=1 & year >= 1600 , absorb(id twentyfive)
		  estimates store IntRateEitherWar`j'
		  eststo ols_EitherIntrateWar`j'
		  replace b_EitherIntrateWar  = _b[shockEither] if _n == `j'+1
		  replace se_EitherIntrateWar = _se[shockEither] if _n == `j'+1
}

forvalues j=0/`horizon' {

reghdfe intrate`j' shockGov `rhscontrolsIntrate' if NewlyTreatedGov ==1 & l.Conflict == 1  & year >= 1600 | F`j'.govcredit ==0 & year >= 1600 , absorb(id twentyfive)
  		  estimates store IntRateGovWar`j'
		  eststo ols_GovIntrateWar`j'
		  replace b_GovIntrateWar  = _b[shockGov] if _n == `j'+1
		  replace se_GovIntrateWar = _se[shockGov] if _n == `j'+1
}


forvalues j=0/`horizon' {

reghdfe intrate`j' shockPriv `rhscontrolsIntrate' if NewlyTreatedDisc ==1 & l.Conflict == 1  & year >= 1600 | F`j'.pricredit ==0 & year >= 1600 , absorb(id twentyfive)
		  estimates store IntRatePrivWar`j'		  
		  eststo ols_PrivIntrateWar`j'
		  replace b_PrivIntrateWar  = _b[shockPriv] if _n == `j'+1
		  replace se_PrivIntrateWar = _se[shockPriv] if _n == `j'+1

}

esttab IntRateEitherWar0 IntRateEitherWar2 IntRateEitherWar4 IntRateEitherWar6 IntRateGovWar0 IntRateGovWar2 IntRateGovWar4 IntRateGovWar6 IntRatePrivWar0 IntRatePrivWar2 IntRatePrivWar4 IntRatePrivWar6 using "$folder\04Tables\IntRateWarIRFs1.tex", replace nogaps title( ) mtitles("(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)" "(9)" "(10)" "(11)" "(12)") nonumbers cells(b(star fmt(%9.2f)) se(par)) starlevels(* 0.1 ** 0.05 *** 0.01) nonumbers stats(F p N N_clust, fmt(%9.2f %9.2f %9.0f %9.0f) labels("$ F $" "$ Prob > F $" "\# Observations" "Countries")) legend label style(tex)
esttab IntRateEitherWar8 IntRateEitherWar10 IntRateEitherWar12 IntRateEitherWar14 IntRateGovWar8 IntRateGovWar10 IntRateGovWar12 IntRateGovWar14 IntRatePrivWar8 IntRatePrivWar10 IntRatePrivWar12 IntRatePrivWar14 using "$folder\04Tables\IntRateWarIRFs2.tex", replace nogaps title( ) mtitles("(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)" "(9)" "(10)" "(11)" "(12)") nonumbers cells(b(star fmt(%9.2f)) se(par)) starlevels(* 0.1 ** 0.05 *** 0.01) nonumbers stats(F p N N_clust, fmt(%9.2f %9.2f %9.0f %9.0f) labels("$ F $" "$ Prob > F $" "\# Observations" "Countries")) legend label style(tex)
clear results



***************
*** Default ***
***************

*default, l.Conflict==0
forvalues j=0/`horizon' {

reghdfe default`j' shockEither `rhscontrolsDefault' if NewlyTreatedGov ==1 & l.Conflict == 0  & year >= 1600 | F`j'.exist !=1 & year >= 1600 , absorb(id decade)
		  estimates store DefaultEither`j'		  
		  eststo ols_EitherDefault`j'
		  replace b_EitherDefault  = _b[shockEither] if _n == `j'+1
		  replace se_EitherDefault = _se[shockEither] if _n == `j'+1
}

forvalues j=0/`horizon' {

reghdfe default`j' shockGov `rhscontrolsDefault' if NewlyTreatedGov ==1 & l.Conflict == 0  & year >= 1600 | F`j'.govcredit ==0 & year >= 1600 , absorb(id decade)
		  estimates store DefaultGov`j'		  
		  eststo ols_GovDefault`j'
		  replace b_GovDefault  = _b[shockGov] if _n == `j'+1
		  replace se_GovDefault = _se[shockGov] if _n == `j'+1
}


forvalues j=0/`horizon' {

reghdfe default`j' shockPriv `rhscontrolsDefault' if NewlyTreatedDisc ==1 & l.Conflict == 0  & year >= 1600 | F`j'.pricredit ==0 & year >= 1600 , absorb(id decade)
		  estimates store DefaultPriv`j'		  
		  eststo ols_PrivDefault`j'
	  replace b_PrivDefault  = _b[shockPriv] if _n == `j'+1
		  replace se_PrivDefault = _se[shockPriv] if _n == `j'+1
}


esttab DefaultEither0 DefaultEither2 DefaultEither4 DefaultEither6 DefaultGov0 DefaultGov2 DefaultGov4 DefaultGov6 DefaultPriv0 DefaultPriv2 DefaultPriv4 DefaultPriv6 using "$folder\04Tables\DefaultIRFs1.tex", replace nogaps title( ) mtitles("(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)" "(9)" "(10)" "(11)" "(12)") nonumbers cells(b(star fmt(%9.2f)) se(par)) starlevels(* 0.1 ** 0.05 *** 0.01) nonumbers stats(F p N N_clust, fmt(%9.2f %9.2f %9.0f %9.0f) labels("$ F $" "$ Prob > F $" "\# Observations" "Countries")) legend label style(tex)
esttab DefaultEither8 DefaultEither10 DefaultEither12 DefaultEither14 DefaultGov8 DefaultGov10 DefaultGov12 DefaultGov14 DefaultPriv8 DefaultPriv10 DefaultPriv12 DefaultPriv14 using "$folder\04Tables\DefaultIRFs2.tex", replace nogaps title( ) mtitles("(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)" "(9)" "(10)" "(11)" "(12)") nonumbers cells(b(star fmt(%9.2f)) se(par)) starlevels(* 0.1 ** 0.05 *** 0.01) nonumbers stats(F p N N_clust, fmt(%9.2f %9.2f %9.0f %9.0f) labels("$ F $" "$ Prob > F $" "\# Observations" "Countries")) legend label style(tex)
clear results


*default, l.Conflict==1
forvalues j=0/`horizon' {

reghdfe default`j' shockEither `rhscontrolsDefault' if NewlyTreatedGov ==1 & l.Conflict == 1  & year >= 1600 | F`j'.exist !=1 & year >= 1600 , absorb(id decade)
		  estimates store DefaultEitherWar`j'		  
		  replace b_EitherDefaultWar  = _b[shockEither] if _n == `j'+1
		  replace se_EitherDefaultWar = _se[shockEither] if _n == `j'+1
}

forvalues j=0/`horizon' {

reghdfe default`j' shockGov `rhscontrolsDefault' if NewlyTreatedGov ==1 & l.Conflict == 1  & year >= 1600 | F`j'.govcredit ==0 & year >= 1600 , absorb(id decade)
		  estimates store DefaultGovWar`j'		  
		  replace b_GovDefaultWar  = _b[shockGov] if _n == `j'+1
		  replace se_GovDefaultWar = _se[shockGov] if _n == `j'+1
}


forvalues j=0/`horizon' {

reghdfe default`j' shockPriv `rhscontrolsDefault' if NewlyTreatedDisc ==1 & l.Conflict == 1  & year >= 1600 | F`j'.pricredit ==0 & year >= 1600 , absorb(id decade)
		  estimates store DefaultPrivWar`j'		  
		  replace b_PrivDefaultWar  = _b[shockPriv] if _n == `j'+1
		  replace se_PrivDefaultWar = _se[shockPriv] if _n == `j'+1

}
esttab DefaultEitherWar0 DefaultEitherWar2 DefaultEitherWar4 DefaultEitherWar6 DefaultGovWar0 DefaultGovWar2 DefaultGovWar4 DefaultGovWar6 DefaultPrivWar0 DefaultPrivWar2 DefaultPrivWar4 DefaultPrivWar6 using "$folder\04Tables\DefaultWarIRFs1.tex", replace nogaps title( ) mtitles("(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)" "(9)" "(10)" "(11)" "(12)") nonumbers cells(b(star fmt(%9.2f)) se(par)) starlevels(* 0.1 ** 0.05 *** 0.01) nonumbers stats(F p N N_clust, fmt(%9.2f %9.2f %9.0f %9.0f) labels("$ F $" "$ Prob > F $" "\# Observations" "Countries")) legend label style(tex)
esttab DefaultEitherWar8 DefaultEitherWar10 DefaultEitherWar12 DefaultEitherWar14 DefaultGovWar8 DefaultGovWar10 DefaultGovWar12 DefaultGovWar14 DefaultPrivWar8 DefaultPrivWar10 DefaultPrivWar12 DefaultPrivWar14 using "$folder\04Tables\DefaultWarIRFs2.tex", replace nogaps title( ) mtitles("(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)" "(9)" "(10)" "(11)" "(12)") nonumbers cells(b(star fmt(%9.2f)) se(par)) starlevels(* 0.1 ** 0.05 *** 0.01) nonumbers stats(F p N N_clust, fmt(%9.2f %9.2f %9.0f %9.0f) labels("$ F $" "$ Prob > F $" "\# Observations" "Countries")) legend label style(tex)
clear results





************
*** IRFs ***
************

*** create confidence bands (in this case 95%) ***
scalar sig = 0.05


replace ci_ul95_EitherIntrate = b_EitherIntrate + invnormal(1-sig/2)*se_EitherIntrate if _n <= (`horizon' + 1)
replace ci_ll95_EitherIntrate = b_EitherIntrate - invnormal(1-sig/2)*se_EitherIntrate if _n <= (`horizon' + 1)
 
replace ci_ul95_GovIntrate = b_GovIntrate + invnormal(1-sig/2)*se_GovIntrate if _n <= (`horizon' + 1)
replace ci_ll95_GovIntrate = b_GovIntrate - invnormal(1-sig/2)*se_GovIntrate if _n <= (`horizon' + 1)
 
replace ci_ul95_PrivIntrate = b_PrivIntrate + invnormal(1-sig/2)*se_PrivIntrate if _n <= (`horizon' + 1)
replace ci_ll95_PrivIntrate = b_PrivIntrate - invnormal(1-sig/2)*se_PrivIntrate if _n <= (`horizon' + 1)

replace ci_ul95_EitherIntrateWar = b_EitherIntrateWar + invnormal(1-sig/2)*se_EitherIntrateWar if _n <= (`horizon' + 1)
replace ci_ll95_EitherIntrateWar = b_EitherIntrateWar - invnormal(1-sig/2)*se_EitherIntrateWar if _n <= (`horizon' + 1)

replace ci_ul95_GovIntrateWar = b_GovIntrateWar + invnormal(1-sig/2)*se_GovIntrateWar if _n <= (`horizon' + 1)
replace ci_ll95_GovIntrateWar = b_GovIntrateWar - invnormal(1-sig/2)*se_GovIntrateWar if _n <= (`horizon' + 1)

replace ci_ul95_PrivIntrateWar = b_PrivIntrateWar + invnormal(1-sig/2)*se_PrivIntrateWar if _n <= (`horizon' + 1)
replace ci_ll95_PrivIntrateWar = b_PrivIntrateWar - invnormal(1-sig/2)*se_PrivIntrateWar if _n <= (`horizon' + 1)

replace ci_ul95_EitherDefault = b_EitherDefault + invnormal(1-sig/2)*se_EitherDefault if _n <= (`horizon' + 1)
replace ci_ll95_EitherDefault = b_EitherDefault - invnormal(1-sig/2)*se_EitherDefault if _n <= (`horizon' + 1)

replace ci_ul95_GovDefault = b_GovDefault + invnormal(1-sig/2)*se_GovDefault if _n <= (`horizon' + 1)
replace ci_ll95_GovDefault = b_GovDefault - invnormal(1-sig/2)*se_GovDefault if _n <= (`horizon' + 1)
 
replace ci_ul95_PrivDefault = b_PrivDefault + invnormal(1-sig/2)*se_PrivDefault if _n <= (`horizon' + 1)
replace ci_ll95_PrivDefault = b_PrivDefault - invnormal(1-sig/2)*se_PrivDefault if _n <= (`horizon' + 1)

replace ci_ul95_EitherDefaultWar = b_EitherDefaultWar + invnormal(1-sig/2)*se_EitherDefaultWar if _n <= (`horizon' + 1)
replace ci_ll95_EitherDefaultWar = b_EitherDefaultWar - invnormal(1-sig/2)*se_EitherDefaultWar if _n <= (`horizon' + 1)

replace ci_ul95_GovDefaultWar = b_GovDefaultWar + invnormal(1-sig/2)*se_GovDefaultWar if _n <= (`horizon' + 1)
replace ci_ll95_GovDefaultWar = b_GovDefaultWar - invnormal(1-sig/2)*se_GovDefaultWar if _n <= (`horizon' + 1)
 
replace ci_ul95_PrivDefaultWar = b_PrivDefaultWar + invnormal(1-sig/2)*se_PrivDefaultWar if _n <= (`horizon' + 1)
replace ci_ll95_PrivDefaultWar = b_PrivDefaultWar - invnormal(1-sig/2)*se_PrivDefaultWar if _n <= (`horizon' + 1)



gen yearAfterShock = .
	forvalues q = 0/`horizon' {
	replace yearAfterShock = `q' if _n == `q'+1
	 }


twoway line b_EitherIntrate ci_ul95_EitherIntrate ci_ll95_EitherIntrate yearAfterShock if yearAfterShock <= 15, name("g1a", replace) nodraw  legend(off) title("Either")

twoway line b_GovIntrate ci_ul95_GovIntrate ci_ll95_GovIntrate yearAfterShock if yearAfterShock <= 15, name("g1b", replace) nodraw  legend(off) title("Government")

twoway line b_PrivIntrate ci_ul95_PrivIntrate ci_ll95_PrivIntrate yearAfterShock if yearAfterShock <= 15, name("g1c", replace) nodraw  legend(off) title("Private")

graph combine g1a g1b g1c, ycommon name(combined, replace)


twoway line b_EitherIntrateWar ci_ul95_EitherIntrateWar ci_ll95_EitherIntrateWar yearAfterShock if yearAfterShock <= 15, name("g2a", replace) nodraw  legend(off) title("Either")

twoway line b_GovIntrateWar ci_ul95_GovIntrateWar ci_ll95_GovIntrateWar yearAfterShock if yearAfterShock <= 15, name("g2b", replace) nodraw  legend(off) title("Government")

twoway line b_PrivIntrateWar ci_ul95_PrivIntrateWar ci_ll95_PrivIntrateWar yearAfterShock if yearAfterShock <= 15, name("g2c", replace) nodraw  legend(off) title("Private")

graph combine g2a g2b g2c, ycommon name(combined, replace)


twoway line b_EitherDefault ci_ul95_EitherDefault ci_ll95_EitherDefault yearAfterShock if yearAfterShock <= 15, name("g3a", replace) nodraw  legend(off) title("Either")

twoway line b_GovDefault ci_ul95_GovDefault ci_ll95_GovDefault yearAfterShock if yearAfterShock <= 15, name("g3b", replace) nodraw  legend(off) title("Government")

twoway line b_PrivDefault ci_ul95_PrivDefault ci_ll95_PrivDefault yearAfterShock if yearAfterShock <= 15, name("g3c", replace) nodraw  legend(off) title("Private")

graph combine g3a g3b g3c, ycommon name(combined, replace)


twoway line b_EitherDefaultWar ci_ul95_EitherDefaultWar ci_ll95_EitherDefaultWar yearAfterShock if yearAfterShock <= 15, name("g4a", replace) nodraw  legend(off) title("Either")

twoway line b_GovDefaultWar ci_ul95_GovDefaultWar ci_ll95_GovDefaultWar yearAfterShock if yearAfterShock <= 15, name("g4b", replace) nodraw  legend(off) title("Government")

twoway line b_PrivDefaultWar ci_ul95_PrivDefaultWar ci_ll95_PrivDefaultWar yearAfterShock if yearAfterShock <= 15, name("g4c", replace) nodraw  legend(off) title("Private")

graph combine g4a g4b g4c, ycommon name(combined, replace)


